<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>javalist</title>
    <link th:href="@{/common/layui-new/layui/css/layui.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/common/layui/admin.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/common/layui-new/layui/layui.js}"></script>
    <script th:src="@{/common/jquery/jquery.js}"></script>
    <link rel="stylesheet" th:href="@{/common/SyntaxHighlighter/styles/shCore.css}" type="text/css">
    <link rel="stylesheet" th:href="@{/common/SyntaxHighlighter/styles/shThemeDefault.css}" type="text/css">

    <script type="text/javascript" th:src="@{/common/SyntaxHighlighter/scripts/XRegExp.js}"></script>
    <script type="text/javascript" th:src="@{/common/SyntaxHighlighter/scripts/shCore.js}"></script>
    <script type="text/javascript" th:src="@{/common/SyntaxHighlighter/scripts/shBrushJava.js}"></script>
    <script type="text/javascript" th:src="@{/common/SyntaxHighlighter/scripts/shBrushJScript.js}"></script>
    <script type="text/javascript" th:src="@{/common/SyntaxHighlighter/scripts/shBrushSql.js}"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space18">
        <div class="layui-col-md12">
            <div th:each="javafile,iterStat : ${current}">
                <div class="layui-card">
                    <div class="layui-card-header"  >
                        <a th:style="'color:red;'" th:text="${javafile.key}"></a>
                        <a href="javascript:;" class="layui-a-tips-left" onclick="addcomments()">添加注释</a>
                        <a href="javascript:;" class="layui-a-tips" onclick="showcommnets()">查看注释</a>
                    </div>

                    <div class="layui-card-body">
                        <div id="div_up_1">
                            <i class="layui-icon layui-icon-addition" onclick="exchange()"></i>

                            <pre th:text="${javafile.value[0]}" class="brush: java">
                                <div ></div>
                            </pre>
                        </div>
                        <div id="div_down_1" style="display: none" onclick="colls()">
                            <i class="layui-icon layui-icon-subtraction"></i>
                            <pre th:text="${javafile.value[1]}" class="brush: java">
                                <div ></div>
                            </pre>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    SyntaxHighlighter.highlight();//设置代码高亮
    function exchange(){
        $("#div_up_1").attr("style","display:none");
        $("#div_down_1").attr("style","display:block");
    }
    function colls(){
        $("#div_up_1").attr("style","display:block");
        $("#div_down_1").attr("style","display:none");
    }

    function addcomments() {
        // $.ajax({
        //     url: "http://192.168.56.1:8888/ecco/addcomment",
        //     type: "get",
        //     success: function (data) {
        //
        //     }
        // });
        layer.open({
            title: "添加注释",
            type: 2,
            area: ['630px', '420px'],
            fixed: false, //不固定
            maxmin: true,
            content: 'addcomment'
        });
    }
    function showcommnets() {
        $.ajax({
            url: "http://192.168.56.1:8888/ecco/showcomment",
            type: "get",
            data: {modle: 1, file: 1},
            success: function (data) {
                layer.open({
                    type: 1,
                    title: false,
                    closeBtn: 0,
                    shadeClose: true,
                    area: ['630px', '360px'],
                    skin: 'yourclass',
                    content: data
                });
            }
        });


    }
</script>
</html>